package org.springframe.aop;

import java.util.Set;

public class SpringAopAutoProxyFactory implements ProxyFactory {

    @Override
    public AopProxy createProxy(Object target, Class<?> clazz, Set<Class> aspectDeclaredClass) {
        Class<?> targetClass = target.getClass();
        if(clazz.isInterface()){
            return new JdkDynamicAopProxy(target,targetClass.getInterfaces(),aspectDeclaredClass);
        }else{
            return new CglibAopProxy(target,aspectDeclaredClass);
        }
    }
}
